<template>
  <view>
    <navigator url="/pages/store/createGoods">
      <view class="cartBtn">
        添加商品
      </view>
    </navigator>



    <goodsTemplate style="width:100%;" :res="goodsList" :storeName="false" />

  </view>
</template>

<script>
import {selectStoreCouponList} from "@/api/store"
import storage from "@/utils/storage";
import { getGoodsList } from "@/api/goods.js";

import tpl_goods from "@/pages/tabbar/home/template/tpl_goods"; //商品分类以及分类中的商品
import goodsTemplate from '@/components/m-goods-list/list'
export default {
  data() {
    return {
      goodsList:[],
      goodsParams: {
        pageNumber: 1,
        pageSize: 10,
        storeId: "",
      },
    }
  },
  components: {
    goods: tpl_goods,
    goodsTemplate
  },
  onLoad(){
    this.getGoodsData();
  },
  onShow(){

  },
  // 下拉加载
  onReachBottom() {
    this.goodsParams.pageNumber++;
    this.getGoodsData();
  },
  methods: {
    /** 加载商品 */
    async getGoodsData() {
      let res = await getGoodsList(this.goodsParams);

      if (res.data.success) {
        this.goodsList.push(...res.data.result.records);
      }
    },
  }
}
</script>

<style>

.cartBtn{
  width: 30vw;
  height: 10vw;
  background: red;
  border-radius: 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #FFF;
  position: relative;
  left: 65vw;
  margin: 3vw 1vw;
}
.goods-scroll-content {
  height: 85vh;
}
.upBtn{
  position: absolute;
  top: 20rpx;
  right: 10rpx;
}
.btnView{
  background: red;
  padding: 1vw;
  color: #FFF;
  border-radius: 5px;
}
</style>
